﻿@model IEnumerable<SklepISI.Core.Models.ProductModel>

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "ListProducts";
}

<div class="span8 well">
    <h2>Produkty</h2>
    @Html.ActionLink("Dodaj produkt", "AddProduct", null, new {@class="btn btn-primary", @id="add-product-button"})<br />
    <div class="span1">
        <b>Kategoria</b>
    </div>
    <div class="span2">
        <b>Produkt</b>
    </div>
    <div class="span1">
        <b>Cena</b>
    </div>
    <div class="span1">
        <b>Dostępny</b>
    </div>
    <div class="span2">
        <b>Akcja</b>
    </div>

@foreach (var product in Model)
{
    <div class="span1" style="text-align:center">
        @Html.DisplayFor(modelItem => product.CategoryId)
    </div>
    <div class="span2">
        @product.Name.Substring(0,product.Name.Length > 20 ? 20:product.Name.Length)@(product.Name.Length > 20 ? "...":"")
    </div>
    <div class="span1">
        @Html.DisplayFor(modelItem => product.Price) zł
    </div>
    <div class="span1" style="text-align:center">
        @Html.DisplayFor(modelItem => product.IsAvailable)
    </div>
    <div class="span2">
        @Html.ActionLink("Edytuj", "EditProduct", new {id = product.ProductId}) | @Html.ActionLink("Usuń", "RemoveProduct", new {id = product.ProductId})
    </div>
}

</div>



